Skip to content

Fix malformed @@ header in formatHunkHeader fallback - #695

Merged
benvinegar merged 2 commits into
modem-dev:mainfrom
YuriNachos:YuriNachos/w5-hunk-header
Aug 10, 2026
Merged

Fix malformed @@ header in formatHunkHeader fallback#695
benvinegar merged 2 commits into
modem-dev:mainfrom
YuriNachos:YuriNachos/w5-hunk-header

Conversation

@YuriNachos

Copy link
Copy Markdown
Contributor

Summary

The fallback branch of formatHunkHeader now emits a well-formed unified-diff @@ header for every Hunk, including the edge case that previously produced a malformed one.

Root cause

The fallback used *Lines (changed-lines count) instead of *Count (total lines incl context) for the @@ -start,count +start,count @@ fields, so a Hunk with context lines got a malformed header.

Changes

  • src/core/hunkHeader.ts — use *Count in the fallback @@ construction (matches the field semantics documented in @pierre/diffs + the existing primary branch).
  • src/core/hunkHeader.test.ts (new, bun:test) — proves red→green: a fallback Hunk with deletionStart:10, deletionCount:4 now yields @@ -10,4 +10,4 @@ (was @@ -10,1 +10,1 @@), plus a pure-addition @@ -0,0 +1,3 @@ case and a context-suffix case.

Test plan

  • bun test src/core/hunkHeader.test.ts — 3 pass, 0 fail.

This change was developed with AI assistance (Claude Code); every changed line was reviewed and understood.

The fallback branch of formatHunkHeader emitted a malformed unified-diff @@ header for the edge-case Hunk shape. Produce a valid @@ -l,s +l,s @@ header matching the standard git format. Adds a regression test.
@greptile-apps

greptile-apps Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

@YuriNachos is attempting to deploy a commit to the Modem Team on Vercel.

A member of the Team first needs to authorize it.

@benvinegar benvinegar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code change is correct, but this user-visible fix needs a patch Changeset for hunkdiff per the repository's release policy. The current branch fails:

bun run changeset:status --since=origin/main
# Some packages have been changed but no changesets were found.

Please add a .changeset/*.md entry with a concise user-facing summary.

This comment was generated by Pi using GPT-5.6 Sol

@YuriNachos

Copy link
Copy Markdown
Contributor Author

Heads-up on the red check, so it doesn't read as a problem with this branch: the failing Vercel job is the fork-deployment authorization gate, not a build or test failure. Its status text is:

Authorization required to deploy.

and the target URL is vercel.com/git/authorize?team=Modem&…, i.e. a request for someone on the Modem team to authorize a deployment from a fork. It is red on every open fork PR in this repo right now, mine and other people's alike — sampled just now: #696, #695, #689 (mine) and #686, #682, #678, #676 (not mine), all with the identical message.

Every check a fork PR can actually influence is green here: Socket Security: Project Report and Socket Security: Pull Request Alerts both pass.

Nothing on this branch can turn Vercel green — it needs the authorize link clicked on your side. Happy to rebase or re-trigger if that helps.

@YuriNachos

Copy link
Copy Markdown
Contributor Author

Added a patch changeset for hunkdiff in .changeset/clean-hunk-header.md. bun run changeset:status --since=origin/main now resolves cleanly:

🦋  - hunkdiff
🦋 info NO packages to be bumped at minor / major

(The red Vercel check is the fork-deployment authorization gate — not a build/test failure — as noted earlier; it is red on every open fork PR in this repo.)

@benvinegar
benvinegar enabled auto-merge (squash) August 10, 2026 12:14
@benvinegar
benvinegar merged commit 63babe0 into modem-dev:main Aug 10, 2026
11 of 12 checks passed
@YuriNachos
YuriNachos deleted the YuriNachos/w5-hunk-header branch August 10, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants